node
can be thought of as Lurch node
, or simply
The other tutorials cover what kinds of objects you can create in Lode and what you can do with them.
- Constructing LCs
- Methods in each LC subclass
- LC tree hierarchies
- Serialization and attributes of LCs
- Free and bound variables
- Connections among LCs
- Pattern matching
Running
To run npm run lode
. Alternatively, you can run it from the scripts
subfolder of
the root folder with the command node lode
. (If you have not yet set up a copy
of this repository with the appropriate Node.js version installed, see
our GitHub README, which explains
how to do so.)
> node lode
Welcome to 𝕃𝕠𝕕𝕖 - the Lurch Node app
(type .help for help)
▶︎
You are now at the Lurch Node REPL command prompt. All of the exported modules in the src/index.js file in this repository. For example, you can now do things like this (see LogicConcept and toPutdown):
Welcome to 𝕃𝕠𝕕𝕖 - the Lurch Node app
(type .help for help)
▶︎ LogicConcept.fromPutdown(`{ :Hello ( World ! ) }`)[0].toPutdown()
'{ :Hello (World !) }'
▶︎
Since creating and viewing LogicConcepts in putdown notation is often what we want,
▶︎ LogicConcept.fromPutdown(`{ :Hello ( World ! ) }`)[0].toPutdown()
'{ :Hello (World !) }'
▶︎ lc(`{ :Hello ( World ! ) }`) // constructs the same thing
{ :Hello (World !) }
There is a similar feature for MathConcepts using smackdown.
▶︎ Algebrite.run(`2^100`)
'1267650600228229401496703205376'
▶︎ Algebrite.run(`(x+1)^10`)
'x^10+10*x^9+45*x^8+120*x^7+210*x^6+252*x^5+210*x^4+120*x^3+45*x^2+10*x+1'
compute
as a synonym for Algebrite.run
, and print
as
a synonym for console.log
.
▶︎ compute(`2^100`)
'1267650600228229401496703205376'
▶︎ print(compute(`(x+1)^10`))
x^10+10*x^9+45*x^8+120*x^7+210*x^6+252*x^5+210*x^4+120*x^3+45*x^2+10*x+1
If you want to inspect the Object structure of an LC (or any object) instead of
seeing its Putdown rendering, you can use the command inspect
.
▶︎ X = lc(`A`)
A
▶︎ inspect(X)
Symbol {
_dirty: true,
_parent: null,
_children: [],
_attributes: Map(1) { 'symbol text' => 'A' },
_origin: null,
_feedbackEnabled: true,
_feedbackQueue: []
}
You can type .features
in